package com.azzcs.blog.service;

import com.azzcs.blog.entity.Article;
import com.azzcs.blog.mapper.ArticleMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: wzg
 * @Dregiate: 2020/12/31 下午4:08
 */
@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    @Cacheable(cacheNames = "article")
    public Page<Article> selectPage(Long current, Long size){
        QueryWrapper queryWrapper = new QueryWrapper();
        Page<Article> page = new Page(current,size);
        articleMapper.selectPage(page, queryWrapper);
        return page;
    }

}
